<!DOCTYPE html>
<title>Verify that drawing to canvas using video with source element does not taint canvas</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<canvas></canvas>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    var canvas = document.querySelector("canvas");

    video.oncanplaythrough = t.step_func_done(function() {
        var width = video.videoWidth / 2;
        var height = video.videoHeight / 2;
        var ctx = canvas.getContext("2d");
        video.pause();
        ctx.drawImage(video, 0, 0, width, height);
        assert_not_equals(ctx.getImageData(0, 0, width, height), null);
    });

    var source = document.createElement("source");
    source.src = "content/counting.ogv";
    video.appendChild(source);
});
</script>